home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / remhead.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  87 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: remhead.c,v 1.5 1996/08/13 13:56:06 digulla Exp $
  4.     $Log: remhead.c,v $
  5.     Revision 1.5  1996/08/13 13:56:06  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.4  1996/08/01 17:41:16  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. /* I want the macros */
  17. #define AROS_ALMOST_COMPATIBLE
  18. #include "exec_intern.h"
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.     #include <exec/lists.h>
  24.     #include <clib/exec_protos.h>
  25.  
  26.     __AROS_LH1I(struct Node *, RemHead,
  27.  
  28. /*  SYNOPSIS */
  29.     __AROS_LHA(struct List *, list, A0),
  30.  
  31. /*  LOCATION */
  32.     struct SysBase *, SysBase, 43, Exec)
  33.  
  34. /*  FUNCTION
  35.     Remove the first node from a list.
  36.  
  37.     INPUTS
  38.     list - Remove the node from this list
  39.  
  40.     RESULT
  41.     The node that has been removed.
  42.  
  43.     NOTES
  44.  
  45.     EXAMPLE
  46.     struct List * list;
  47.     struct Node * head;
  48.  
  49.     // Remove node and return it
  50.     head = RemHead (list);
  51.  
  52.     BUGS
  53.  
  54.     SEE ALSO
  55.  
  56.     INTERNALS
  57.  
  58.     HISTORY
  59.     26-08-95    digulla created after EXEC-Routine
  60.     26-10-95    digulla adjusted to new calling scheme
  61.  
  62. ******************************************************************************/
  63. {
  64.     __AROS_FUNC_INIT
  65.     struct Node * node;
  66.  
  67.     assert (list);
  68.     /*
  69.     Unfortunately, there is no (quick) check that the node
  70.     is in a list
  71.     */
  72.  
  73.     /* Get the address of the first node or NULL */
  74.     node = list->lh_Head->ln_Succ;
  75.     if (node)
  76.     {
  77.     node->ln_Pred = (struct Node *)list;
  78.     node = list->lh_Head;
  79.     list->lh_Head = node->ln_Succ;
  80.     }
  81.  
  82.     /* Return the address or NULL */
  83.     return node;
  84.     __AROS_FUNC_EXIT
  85. } /* RemHead */
  86.  
  87.